#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>

int main()
{
    int ret = fork();
    if(ret < 0){
        perror("fork");
        return 0;
    }else if(ret == 0){
        sleep(2);
    }else{
        printf("i am father\n");
        int status;
        pid_t pid = wait(&status);
        printf("退出码：%d", (status >> 8) & 0xff);
    }
    return 1;
}
